" line number
set nu
set autoindent

set pastetoggle=<F2>

set hlsearch

let mapleader=','
" <cr> enter
inoremap <leader>w <Esc>:w<cr>
noremap <leader>w <Esc>:w<cr>

inoremap <leader>q <Esc>:q<cr>
noremap <leader>q <Esc>:q<cr>

inoremap <leader>x <Esc>:x<cr>
noremap <leader>x <Esc>:x<cr>

" `^ to next write site
inoremap jj <Esc>`^

" exchange buffer
nnoremap <silent> [b :bprevious<cr>
nnoremap <silent> [n :bnext<cr>

" use ctrl +h/j/k/l switch window
noremap <C-h> <C-w>h
noremap <C-j> <C-w>j
noremap <C-k> <C-w>k
noremap <C-l> <C-w>l


call plug#begin('~/.vim/plugged')
" 1.startify
Plug 'mhinz/vim-startify'
" 2. theme 
Plug 'altercation/vim-colors-solarized'
" 3. airline and theme
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
" 4. nerdtree
Plug 'preservim/nerdtree'
" 5. ctrlp
Plug 'ctrlpvim/ctrlp.vim'
" 6. easy motion
Plug 'easymotion/vim-easymotion'
" 7. vim-surround
Plug 'tpope/vim-surround'

call plug#end()


" -------------------------------------
"  plug config
"  ------------------------------------

" 2.vim-colors-solarize
syntax enable
let g:solarized_termcolors=16
set t_Co=256
set background=light
colorscheme solarized

if has('gui_running')
    set background=dark
else
    set background=light
endif
" 4.nerdtree
nnoremap <leader>v :NERDTreeFind<cr>
nnoremap <leader>g :NERDTreeToggle<cr>
let NERDTreeShowHidden=1

" 5. ctrlp
let g:ctrlp_map = '<c-p>'
" 6. easy motion
map ss <Plug>(easymotion-s2)
